<fieldset class="fieldset">
  <legend> <%=h pluralize(Recipe.count, 'Recipe')%> listed</legend>

<% if @recipes.empty? %>
  <br/>
    No recipes configured yet.<br />
    Recipes are custom Capistrano tasks and variables that can be used across stages.
  <br/>
<% else %>
  <table class="sortable">
    <tr>
      <th width="39%">Name</th>
      <th width="59%">Description</th>
      <th width="1%">#Stages</th>
      <th width="1%">Created At</th>
    </tr>
    <% for recipe in @recipes %>
      <tr class="<%= cycle :even, :odd, :name => 'recipes'  %>">
        <td><%= link_to h(recipe.name), recipe_path(recipe) %></td>
        <td><%=h recipe.description %></td>
        <td><%=h recipe.stages.count %></td>
        <td><%=h recipe.created_at.to_s(:date_with_day) rescue nil %></td>
        <% if current_user.admin? %>
          <td><%= link_to 'Edit', edit_recipe_path(recipe) %></td>
          <td><%= link_to 'Delete', recipe_path(recipe), :confirm => 'Are you sure?', :method => :delete %></td>
        <% end %>
      </tr>
    <% end %>
  </table>
<% end %>

<% if current_user.admin? %>
  <br />
  <%= link_to 'New recipe', new_recipe_path, :class => 'arrow_link' %>
<% end %>

</fieldset>

<% content_for(:breadcrumb) do %>
  <% breadcrumb_box do %>
    <%= link_to "Recipes", recipes_path %>
  <% end %>
<% end %>

<% content_for(:page_title) do %>
  <% @page_title = "Recipes" %>
  <h2>Recipes</h2>
<% end %>
